package com.xinxin.intelligenceexam.studyMenu.tapToLarger;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.xinxin.intelligenceexam.R;
import com.xinxin.intelligenceexam.utils.view.ImageLoader;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class TapToLargerActivity extends AppCompatActivity {

    @BindView(R.id.iv_tap_net)
    ImageView mIvTapNet;
    @BindView(R.id.iv_tap_local)
    ImageView mIvTapLocal;
    @BindView(R.id.activity_tag_to_larger)
    RelativeLayout mActivityTagToLarger;
    String uri = "";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tap_to_larger);
        ButterKnife.bind(this);
        uri = "http://photo.scol.com.cn/hdp/img/attachement/jpg/site2/20140422/00219b7b064914c05a234b.jpg";
        ImageLoader.getInstance().displayImage(this, uri, mIvTapNet);
    }

    @OnClick({R.id.iv_tap_net, R.id.iv_tap_local})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_tap_net:
                Intent intent = new Intent(TapToLargerActivity.this, SpaceImageDetailActivity.class);
                //intent.putExtra("images", (ArrayList<String>) datas);
//                intent.putExtra("position", position);
                intent.putExtra("uri", uri);
//                intent.putExtra("img", mIvTapNet.geti);
                int[] location = new int[2];
                mIvTapNet.getLocationOnScreen(location);
                intent.putExtra("locationX", location[0]);
                intent.putExtra("locationY", location[1]);

                intent.putExtra("width", mIvTapNet.getWidth());
                intent.putExtra("height", mIvTapNet.getHeight());
                startActivity(intent);
                overridePendingTransition(0, 0);
                break;
            case R.id.iv_tap_local:
                break;
        }
    }
}
